import org.apache.commons.io.FileUtils;
 


def xdown = {
	url ->

	url = url.replace("html","shtml")
	//println url

	URLConnection conn = new URL(url).openConnection();
	conn.setRequestProperty("Accept-Language","zh-cn");


	conn.setRequestProperty("user-agent","mozilla/4.0 (compatible; msie 6.0; windows 2000)"); 


	conn.setRequestProperty("Connection","Keep-Alive");
	conn.setRequestProperty("Cache-Control","no-cache");
	System.setProperty("sun.net.client.defaultConnectTimeout", "30000");
	System.setProperty("sun.net.client.defaultReadTimeout", "60000");
	((HttpURLConnection)conn).setRequestMethod( "GET");

	def r = new InputStreamReader(conn.getInputStream(), "GBK").text
	// println  r  
	def pattern= ~"http://images.enet.com.cn/eschool/word2003/[0-9]+.swf"

	def matcher =  pattern.matcher(r)
	def swf = ""
	if(matcher.find()){
		swf = matcher.group() 
	}
	return swf
}

def id = 0
new File("c://cccc.txt").eachLine({
    line ->
    
//    def pattern= ~"<a href=\"/(A[0-9]+.html)\">([^<]+)</a>"
    def pattern= ~"<A href=\"/(A[0-9]+.html)\" \ntarget=_blank>([^<]+)</A> "
    def matcher = pattern.matcher(line)
    while(matcher.find()){
        //println matcher.group(1) +  matcher.group(2)
        id++  
//if(id < 2){      
        def file =  matcher.group(2)
        
//        def swf = xdown("http://www.enet.com.cn/article/2005/0603/" + matcher.group(1).trim())
       
//        FileUtils.copyURLToFile(new URL(swf), new File("E:\\word\\" + id + file.trim() + ".swf")); 
//        println swf + file +  " ==  OK!" 
        println matcher.group(1) + matcher.group(2)
//}
    }
})


println id